/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package bobbietalk.semantics.compiler;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 *
 * @author roberto
 */
public class MetaCodeManager {
    
   static Pattern pat = Pattern.compile("@META\\{([^,]+),([^,]+)\\}");
   
   public static String [] getMetaArgs(String meta) throws MetaParserException {
       
       Matcher m = pat.matcher(meta);
       
       if (m.matches()) {
           
           String res [] = new String[m.groupCount()];
           
           for (int i=0; i<m.groupCount(); i++) {
               
               res[i] = m.group(i+1);
               
           }
           
           return res;
           
       }
       
       throw new MetaParserException("invalid meta string: "+meta);
   }
    
}
